package com.cwnu.config;

import com.cwnu.interceptor.TokenInterceptor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ProjectName: mall-cwnu
 * @Titile: MyMVCConfig
 * @Author: Lucky
 * @Description: 配置mvc
 */
@SpringBootConfiguration
public class MyMVCConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenInterceptor())
                .addPathPatterns("/user/**") //拦截的路径
                .excludePathPatterns("/user/login"); //放行的路径
    }
}
